#include<iostream>
#include<iterator>
#include<functional>
#include<algorithm>
#include<vector>

using std::cout;
using std::endl;
using std::function;
using std::back_insert_iterator;
using std::copy;
using std::remove_if;
using std::vector;
using std::ostream_iterator;

void fp(int a)
{
    cout<<endl<<a<<endl;
}
int main(void)
{
    //vector数据
    vector<int> vec={1,2,3,8,6,5,0};
    
    vector<int> vec1={0,0,0,0};

    //流迭代器？
    copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));

    //尾后插入
    copy(vec.begin(),vec.end(),back_insert_iterator<vector<int>>(vec1));
    cout<<endl;
    copy(vec1.begin(),vec1.end(),ostream_iterator<int>(cout," "));

    //lambda直接用function容器
    cout<<endl;
    function<void(int)> func =[vec](int param){
    copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));
    cout<<param<<endl;};
    func(100);

    //使用bind绑定并用function接受
    using p=void(*)(int );

    p p1=fp;

    p1(100);
    cout<<" line************"<<endl;
    cout<<endl;
    //std::placeholder
    function<void()> func1 = bind(func,100);
    func1();

        
}
